package ar.com.solidussource.howmuchservices.backend.bo.impl;

import ar.com.solidussource.framework.backend.bo.exception.BusinessException;
import ar.com.solidussource.howmuchservices.backend.bo.PersonCRUDBO;
import ar.com.solidussource.howmuchservices.backend.bo.UserBO;
import ar.com.solidussource.howmuchservices.backend.bo.UserCRUDBO;
import ar.com.solidussource.howmuchservices.common.entities.User;

public class UserBOImpl implements UserBO {
	
	private UserCRUDBO userCRUDBO;
	private PersonCRUDBO personCRUDBO;

	@Override
	public void createUserFromScratch(User user) throws BusinessException {
		personCRUDBO.saveNew(user.getPerson());
		userCRUDBO.saveNew(user);
	}

	@Override
	public void updateUser(User user) throws BusinessException {
		personCRUDBO.saveOrUpdate(user.getPerson());
		userCRUDBO.saveOrUpdate(user);
		
	}

	public UserCRUDBO getUserCRUDBO() {
		return userCRUDBO;
	}

	public void setUserCRUDBO(UserCRUDBO userCRUDBO) {
		this.userCRUDBO = userCRUDBO;
	}

	public PersonCRUDBO getPersonCRUDBO() {
		return personCRUDBO;
	}

	public void setPersonCRUDBO(PersonCRUDBO personCRUDBO) {
		this.personCRUDBO = personCRUDBO;
	}

}
